test(remap): add comprehensive tests and fix error messages for remap feature - #6
Open
rafaio1 wants to merge 2 commits into
Open
test(remap): add comprehensive tests and fix error messages for remap feature#6rafaio1 wants to merge 2 commits into
rafaio1 wants to merge 2 commits into
Conversation
- Add 'remap' config key accepting ordered {from, to} mappings
- First match wins; collisions report both source paths
- Traversal rejection on configured values AND resulting paths
- stripPrefix becomes sugar for single {from, to: ''} mapping
- Backward compatible: existing stripPrefix configs produce identical packs
- Mutual exclusion: cannot set both stripPrefix and remap
Design credit: @xusuxiang8 (sparepack#3, account deleted)
Traversal-on-configured-values check carries forward from @rafaio1's PR mxx1111#2
Closes #19
… feature - Export applyRemap for direct unit testing - Fix error messages: stripPrefix -> remap in collision/no-match errors - Add 7 new config tests: multiple mappings, ordering, collision with both paths, traversal in from/to, absolute path rejection, no-match error wording, stripPrefix+remap mutual exclusion - Update 2 e2e tests to match corrected error message wording - All 91 tests passing
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds comprehensive test coverage for the
remapconfig feature and fixes error message wording.Changes
applyRemapfromsrc/pack.mjsfor direct unit testingstripPrefix→remapin collision and no-match errors (the old name was misleading after the generalisation in feat: add stripPrefix config to remap pack destination paths #1)test/config.test.mjs):fromandtostripPrefix+remapmutual exclusiontest/e2e.test.mjs) to match corrected error messagesTest Results
All 91 tests passing locally with
node --test test/*.test.mjs.Context
This resets the 48h review timer per maintainer request on mxx1111/spare-cycles#19. The implementation itself was already merged in #1; this PR only adds the missing test safety net and corrects user-facing error text.